package com.hxalex.simulationhandle.accessbilityService.command.wifi;

import android.view.accessibility.AccessibilityNodeInfo;

import com.hxalex.simulationhandle.accessbilityService.command.base.BaseCommand;
import com.hxalex.simulationhandle.accessbilityService.manger.WifiManger;
import com.hxalex.simulationhandle.accessbilityService.receiver.base.BaseReceiver;
import com.hxalex.simulationhandle.accessbilityService.receiver.wifi.BackWifiInMainReceiver;

/**
 * Created by hx_Alex on 2018/5/26.
 */

public class BackWifiInMainCommand extends BaseCommand {

    private BackWifiInMainReceiver.onBackToAppMainListener onBackToAppMainListener;
    private AccessibilityNodeInfo nowInfo;
    public void setOnBackToAppMainListener( BackWifiInMainReceiver.onBackToAppMainListener onBackToAppMainListener) {
        this.onBackToAppMainListener = onBackToAppMainListener;
        if(receiver instanceof BackWifiInMainReceiver)
        {
            ((BackWifiInMainReceiver)receiver).setOnBackToAppMainListener(onBackToAppMainListener);
        }
    }

    public AccessibilityNodeInfo getNowInfo() {
        return nowInfo;
    }

    public void setNowInfo(AccessibilityNodeInfo nowInfo) {
        this.nowInfo = nowInfo;
    }

    public BackWifiInMainCommand(WifiManger wifiManger, BaseReceiver receiver) {
        super(wifiManger, receiver);
    }

    @Override
    public void execute() {
        BackWifiInMainReceiver backWifiInMainCommand=(BackWifiInMainReceiver) receiver;
        ((BackWifiInMainReceiver) receiver).setInfo(nowInfo);
        backWifiInMainCommand.doSomething();
    }
}
